//package com.lzp.service;
//
//import com.lzp.batch.MyExcelReader;
//import com.lzp.batch.MyLineMapper;
//import org.springframework.batch.core.Job;
//import org.springframework.batch.core.JobParametersBuilder;
//import org.springframework.batch.core.JobParametersInvalidException;
//import org.springframework.batch.core.launch.JobLauncher;
//import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
//import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
//import org.springframework.batch.core.repository.JobRestartException;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.Date;
//
///**
// * @author : lzp
// * @date : 2021/9/22 15:46
// * @describe : TODO
// * @vision 1.0
// */
//@Service
//public class BatchService {
//    @Autowired
//    JobLauncher jobLauncher;
//    @Autowired
//    Job job;
//    public String startBatch(){
//        try {
//            jobLauncher.run(job,new JobParametersBuilder().addDate("nowTime",new Date()).toJobParameters());
//            return "success";
//        } catch (JobExecutionAlreadyRunningException e) {
//            e.printStackTrace();
//        } catch (JobRestartException e) {
//            e.printStackTrace();
//        } catch (JobInstanceAlreadyCompleteException e) {
//            e.printStackTrace();
//        } catch (JobParametersInvalidException e) {
//            e.printStackTrace();
//        }
//        return "error";
//    }
//
//}
